;(function($){

	jQuery.extend({

		checkSmsOtp:function(smsOtpInput){

			var smsOtp=$(smsOtpInput).val();

			return (/^\d{6}$/).test(smsOtp)

		},

		isNotNull:function(input){

			var val=$(input).val();

			return ('/S').test(val);

		},

		checkNull:function(input){

			var val=$(input).val();

			if(val==""){

				return false;

			}

			else{

				return true;

			}

		},

		checkName:function(fullname){

			var val=$(fullname).val();

			return (/^[\u4e00-\u9fa5]{2,}$/).test(val);

		},

		checkPhone:function(phoneInput){

		    var phone = $(phoneInput).val();

		    if(!(/^1[34578]\d{9}$/.test(phone))){

		        return false;

		    }

		    else{

		        return true;

		    }

		},

		checkCodeLength:function(input){

			var inputVal=$(input).val();

			if(inputVal==null||inputVal.length<=3){

				return false;

			}

			return true

		},

		checkPwdLength:function(input){

			var inputVal=$(input).val();

			if(inputVal==null||inputVal.length<=7){

				return false;

			}

			return true;

		},

		checkPwdSame:function(input1,input2){

			var input1Val=$(input1).val();

			var input2Val=$(input2).val();

			if(input1Val.length>=8&&input2Val.length>=8){

				if(input1Val==input2Val){

					return true

				}

			}

			return false;

		},

		checkPostcode:function(postcodeInput){

			var postCode = $(postcodeInput).val();

			if(!(/^[1-9]\d{5}(?!\d)$/.test(postCode))){

				return false;

			}else{

				return true;

			}

		},

		checkProvince:function(select){

			var address = $(select).val();

			if(address != "0"){

				return true;

			}else{

				return false;

			}

		},

		//获取浏览器类型

		getExplorerInfo:function() {

			 var explorer = window.navigator.userAgent.toLowerCase() ;

			 //ie 

			 if (explorer.indexOf("msie") >= 0) {

			    var ver=explorer.match(/msie ([\d.]+)/)[1];

			    return {type:"IE",version:ver};

			 }

			 //firefox 

			 else if (explorer.indexOf("firefox") >= 0) {

			    var ver=explorer.match(/firefox\/([\d.]+)/)[1];

			    return {type:"Firefox",version:ver};

			 }

			 //Chrome

			 else if(explorer.indexOf("chrome") >= 0){

			    var ver=explorer.match(/chrome\/([\d.]+)/)[1];

			     return {type:"Chrome",version:ver};

			 }

			 //Opera

			 else if(explorer.indexOf("opera") >= 0){

			 var ver=explorer.match(/opera.([\d.]+)/)[1];

			 return {type:"Opera",version:ver};

			 }

			 //Safari

			 else if(explorer.indexOf("Safari") >= 0){

			 var ver=explorer.match(/version\/([\d.]+)/)[1];

			 return {type:"Safari",version:ver};

			 }

		},

		//鍊掕鏃�start

		countdown:function(self,timeNum){

			$(self).siblings('.countdowNum').show();

			var i =timeNum;

			var timer = setInterval(function(){

				$(self).siblings('.countdowNum').html(i);

				i--;

				if(i<0){

					$(self).siblings('.countdowNum,.state').hide();

					i =timeNum;

					$(self).removeAttr('disabled');

					clearInterval(timer);

				}

			},1000);

		},

		subClick:function(clickObj){

			  $.delBackgroundColor();

			  var self = $(clickObj);

			  self.css({'background':"#f3cb29",'color':"#000"})

			  var ulObj  = self.find('ul');

			    if (ulObj.length != 0) {

			    	ulObj.css('background',"#f3cb29");

			    }

		},

		delBackgroundColor:function(){

			var navItemList = $(".nav-item");

			   for (var i = 0; i < navItemList.length; i++) {

				   $(navItemList[i]).css({'background':"#fff",'color':"#737373"})

				    $(navItemList[i]).removeClass('active');

				   var ulList =  $(navItemList[i]).find('ul');

			        if (ulList.length != 0) {

			        	$(ulList).css("background","#fff");

			        }

			    }

		},

		//鍊掕鏃�end

		serializeObject : function(obj) {

		      var o = {};

		      var a = $(obj).serializeArray();

		      $.each(a, function() {

		          if (o[this.name] !== undefined) {

		              if (!o[this.name].push) {

		                  o[this.name] = [o[this.name]];

		              }

		              o[this.name].push(this.value || '');

		          } else {

		              o[this.name] = this.value || '';

		          }

		      });

		      return o;

		    },

	

	})

})(jQuery)

